﻿using Common;
using IntelligentFiles.HcControl;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace IntelligentFiles
{
    public partial class Login : Form
    {
        public Login()
        {
            InitializeComponent();
        }
        /// <summary>
        /// 双击退出
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void pic_logo_DoubleClick(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void btn_login_Click(object sender, EventArgs e)
        {
            string name = text_user.Text.Replace(" ", "");
            if (name == "admin")
            {
                Admin ba = new Admin();

                ba.Show();
            }
            else
            {
                User bu = new User();

                bu.Show();
            }
        }

        private void pic_person_Click(object sender, EventArgs e)
        {
            MessageBox.Show("打开人脸识别");
        }

        private void Login_Load(object sender, EventArgs e)
        {
            //系统初始化
            Init();

        }
        /// <summary>
        /// 系统初始化
        /// </summary>
        private void Init()
        {
            try
            {
                //日志初始化
                CommonApi.initLogThread();
                //系统参数初始化
                CommonApi.readConfig();
                //柜子参数初始化
                boxShow.readCabInfo();
            }
            catch (Exception ex)
            {
                MessageBox.Show("系统初始化异常,"+ex.ToString());
            }
        }
    }
}
